﻿using System;
using System.Globalization;

namespace 历史记录.Helper
{
    public static class HistoryHelp
    {
        public const string Format = "_yy_MM_dd";

        public static string ToTableName(this DateTime date)
        {
            return date.ToString(Format);
        }

        public static bool IsTableName(this string Name)
        {
            if (DateTime.TryParseExact(Name, Format, CultureInfo.InvariantCulture, DateTimeStyles.None, out var date))
            {
                return date.ToTableName() == Name;
            }
            return false;
        }
    }
}